<template>
    <div class="control-setting">
        <div class="conterol-left">
            <div class="left-1">
                <!-- <RiskEntryInput @set-entry-data="getEntryslist" placeholder="产品代码/名称" /> -->
                <!-- <el-select placeholder="产品代码/名称" clearable size="mini" v-model="controlData" @change="productType(controlData)">
                    <el-option filterable v-for="itme in settingInfo" :key="itme.id" :label="itme.label" :value="itme.id"> </el-option>
                </el-select> -->
                <RiskVirtualSelect
                    v-model="controlData"
                    :selectData="selectData1"
                    placeholder="请输入产品代码/名称"
                    @change="productType(controlData)"
                    clearable
                ></RiskVirtualSelect>
                <p class="left-p">
                    只显示本地条目:
                    <el-switch size="mini" active-color="#13ce66" inactive-color="#eee" v-model="showLocality" @change="showLocalData" />
                </p>
            </div>
            <div class="left-2">
                <el-tree
                    class="filter-tree"
                    :data="treeData"
                    :props="defaultProps"
                    :expand-on-click-node="false"
                    :filter-node-method="filterNode"
                    default-expand-all
                    highlight-current
                    ref="tree"
                    @node-click="handleNodeClick"
                >
                    <span slot-scope="{ node }">
                        <span :title="node.label">{{ node.label }}</span>
                    </span>
                </el-tree>
            </div>
            <div class="left-3">
                <yh-tree
                    class="filter-tree"
                    :data="treeTypeData"
                    :props="defaultProps"
                    :expand-on-click-node="false"
                    :filter-node-method="filterNode"
                    default-expand-all
                    highlight-current
                    ref="tree"
                    @node-click="handleTypeClick"
                >
                    <span slot-scope="{ node }">
                        <span :title="node.label">{{ node.label }}</span>
                    </span>
                </yh-tree>
            </div>
        </div>
        <div class="conterol-right">
            <div style="border: 1px solid #eee; display: flex">
                <div class="right-1">
                    <el-button type="primary" size="mini" @click="lookControls = true">查询</el-button>
                    <el-button type="primary" size="mini" @click="resetData">刷新</el-button>
                    <el-button type="primary" size="mini" id="entry-test-btn_add" v-authCode.show="B_0015" @click="addTabs('add', '')"
                        >新增</el-button
                    >
                    <el-button type="danger" size="mini" v-authCode.show="B_0016" @click="deleteList()">删除</el-button>
                    <el-dropdown @command="handleCommand">
                        <el-button type="primary" size="mini" v-authCode.show="B_0019"
                            >导出<i class="el-icon-arrow-down el-icon--right"></i
                        ></el-button>
                        <el-dropdown-menu slot="dropdown">
                            <el-dropdown-item command="Excel">导出 Excel</el-dropdown-item>
                            <el-dropdown-item command="Json">导出 Json</el-dropdown-item>
                        </el-dropdown-menu>
                    </el-dropdown>
                    <el-button type="primary" size="mini" v-authCode.show="B_0112" @click="putVisible = true">导入</el-button>
                    <el-button type="primary" size="mini" v-authCode.show="B_0017" @click="stateList('1')">启用</el-button>
                    <el-button type="danger" size="mini" v-authCode.show="B_0018" @click="stateList('2')">禁用</el-button>
                    <el-button type="primary" size="mini" v-authCode.show="B_0020" @click="layoutDialog = true">布局设置</el-button>
                    <el-button type="primary" size="mini" v-authCode.show="B_0035" @click="openEntryVisible">添加组</el-button>
                    <el-button type="primary" size="mini" v-authCode.show="B_0309" @click="openEmpowerment">条目赋权</el-button>
                    <!-- <el-button type="primary" size="mini" v-authCode.show="B_0015" @click="addTabs('addUFX', '')">新增(UFX)</el-button> -->
                </div>
            </div>
            <div class="right-2">
                <el-table
                    :data="tableData"
                    tooltip-effect="dark"
                    style="width: 100%; min-height: 320px"
                    border
                    ref="table"
                    @row-dblclick="rowClick"
                    size="mini"
                    height="calc(100vh - 210px)"
                    :auto-resize="true"
                    v-loading="tabloading"
                    :row-style="isRed"
                    @sort-change="handleSort"
                    :default-sort="{ prop: sortProp, order: sortOrder }"
                >
                    <RiskTableSelection
                        row-key="entryCode"
                        :current-page-table-list="tableData"
                        :selected="selectedList"
                        show-drop-down
                        :drop-down-list="[{ text: '选择全部', value: 'all' }]"
                        :disabled-method="disabledFun"
                        @dropdown-click="dropdownClick"
                        width="60"
                    />
                    <el-table-column label="条目编号" width="120" prop="entryCode" fixed="left" sortable="custom" show-overflow-tooltip>
                        <template slot-scope="scope">
                            <span v-if="scope.row.modifyType === '2' && scope.row.modifyStatus === '1'">
                                <i class="el-icon-setting" />{{ scope.row.entryCode }}
                            </span>
                            <span v-else-if="scope.row.modifyType === '3' && scope.row.modifyStatus === '1'">
                                <i class="el-icon-delete" />{{ scope.row.entryCode }}
                            </span>
                            <span v-else-if="scope.row.modifyType === '1' && scope.row.modifyStatus === '1'">
                                <i class="el-icon-folder-add" />{{ scope.row.entryCode }}
                            </span>
                            <span v-else-if="scope.row.modifyType === '4' && scope.row.modifyStatus === '1'">
                                <i class="el-icon-setting" />{{ scope.row.entryCode }}
                            </span>
                            <span v-else>
                                {{ scope.row.entryCode }}
                            </span>
                        </template>
                    </el-table-column>

                    <el-table-column
                        v-for="(col, index) in showColumns"
                        :key="index"
                        :prop="col.prop"
                        :label="col.title"
                        :width="col.width"
                        :min-width="col.minWidth || '105px'"
                        show-overflow-tooltip
                        sortable="custom"
                    >
                        <template slot-scope="scope">
                            <!-- <span v-if="col.funcBody" style="float:right">
                                {{ col.funcBody(scope.row[col.prop], scope.row) }}
                            </span> -->
                            <span v-if="['thresholdValue1', 'thresholdValue2', 'thresholdValue3'].includes(col.prop)" style="float: right">
                                {{ scope.row[col.prop] ? thresholdTypeFormat(scope.row[col.prop], scope.row.unit) : '' }}
                            </span>
                            <span v-else-if="['saThresholdValue'].includes(col.prop)" style="float: right">
                                {{ scope.row[col.prop] }}
                            </span>
                            <!-- <span v-else-if="['modifyDate'].includes(col.prop)">
                                {{ scope.row[col.prop] }} {{ timeFormat(scope.row.modifyTime) }}
                            </span> -->
                            <span v-else v-html="getTablesData(scope.row, col.prop)"></span>
                        </template>
                    </el-table-column>

                    <el-table-column label="操作" fixed="right" width="140">
                        <template slot-scope="scope">
                            <RiskIconButton
                                type="primary"
                                v-authCode="B_0022"
                                icon="el-icon-view"
                                topTitle="查看条目"
                                size="mini"
                                @on-click="lookData(scope.row)"
                            ></RiskIconButton>
                            <!-- modifyStatus，待复核1，通过2，不通过3，废弃4 -->
                            <!-- sourceType数据来源 -->
                            <!-- modifyType新增条目1，修改条目2，删除条目：3，状态修改4 -->
                            <RiskIconButton
                                type="primary"
                                v-authCode="B_0021"
                                icon="el-icon-edit"
                                topTitle="编辑条目"
                                size="mini"
                                :disabled="
                                    ['1'].includes(scope.row.modifyStatus)
                                        ? userInfo.superuser == true
                                            ? false
                                            : userInfo.userCode == scope.row.checkModifyUserCode
                                            ? false
                                            : true
                                        : false
                                "
                                @on-click="getEditType(scope.row)"
                            ></RiskIconButton>
                            <el-popover placement="top" width="240" trigger="hover" :popper-class="'pop-cla'">
                                <RiskIconButton
                                    type="primary"
                                    v-authCode="B_0023"
                                    icon="el-icon-brush"
                                    topTitle="自定义"
                                    size="mini"
                                    @on-click="addTabs('customize', scope.row.entryCode)"
                                ></RiskIconButton>
                                <RiskIconButton
                                    type="primary"
                                    v-authCode="B_0023"
                                    icon="el-icon-document-copy"
                                    topTitle="复制条目"
                                    size="mini"
                                    :disabled="['1'].includes(scope.row.modifyStatus) && ['1'].includes(scope.row.modifyType)"
                                    @on-click="addTabs('copy', scope.row.entryCode)"
                                ></RiskIconButton>
                                <RiskIconButton
                                    type="primary"
                                    v-authCode="B_0023"
                                    icon="el-icon-printer"
                                    topTitle="条目修改记录"
                                    size="mini"
                                    @on-click="addTabs('record', scope.row.entryCode)"
                                ></RiskIconButton>
                                <RiskIconButton
                                    type="danger"
                                    v-authCode="B_0023"
                                    icon="el-icon-delete"
                                    topTitle="删除条目"
                                    size="mini"
                                    :disabled="['1'].includes(scope.row.modifyStatus) || !['1'].includes(scope.row.sourceType)"
                                    @on-click="deleteOne(scope.row)"
                                ></RiskIconButton>
                                <RiskIconButton
                                    type="primary"
                                    v-authCode="B_0023"
                                    :disabled="scope.row.useO32Cal"
                                    icon="el-icon-set-up"
                                    topTitle="条目校验"
                                    size="mini"
                                    @on-click="verifyInfo(scope.row)"
                                ></RiskIconButton>
                                <el-button slot="reference" size="mini" type="text" style="padding: 0 !important; margin-left: -12px">...</el-button>
                            </el-popover>
                        </template>
                    </el-table-column>
                </el-table>
                <div class="block">
                    <risk-pagination :paging="paging" @page-change="currentChange"></risk-pagination>
                </div>
                <yh-dialog
                    title="查询条目信息"
                    :visible.sync="lookControls"
                    width="680px"
                    v-loading="loading"
                    drag
                    :close-on-click-modal="false"
                    :close-on-press-escape="false"
                >
                    <div class="con-select-div">
                        <div class="divs">
                            <div class="divs-left">
                                <span>条目编号</span>
                                <el-input
                                    class="divs-left-input"
                                    size="mini"
                                    v-model="entryCodeLits"
                                    @input="changEntrycode(entryCodeLits)"
                                    placeholder="支持','分割"
                                />
                                <el-checkbox
                                    size="mini"
                                    label="准确搜索"
                                    style="margin-left: 8px; width: 133px"
                                    v-model="selectData.precision"
                                    border
                                ></el-checkbox>
                            </div>
                            <div class="divs-right">
                                <span>作用范围</span>
                                <el-select size="mini" multiple collapse-tags v-model="selectData.riskCalTypes" class="ringt-input">
                                    <el-option value="0" label="静态"></el-option>
                                    <el-option value="1" label="指令"></el-option>
                                </el-select>
                            </div>
                        </div>
                        <div class="divs">
                            <div class="divs-left">
                                <span>风险说明</span>
                                <el-input class="divs-left-input01" v-model="selectData.entryName" size="mini" />
                            </div>
                            <div class="divs-right">
                                <span>启用状态</span>
                                <el-select size="mini" v-model="selectData.entryStatuss" multiple collapse-tags class="ringt-input">
                                    <el-option value="0" label="禁用"></el-option>
                                    <el-option value="1" label="启用"></el-option>
                                </el-select>
                            </div>
                        </div>
                        <div class="divs">
                            <div class="divs-left">
                                <span>风险等级</span>
                                <el-select
                                    class="left-input2"
                                    v-model="selectData.controlGrades"
                                    size="mini"
                                    multiple
                                    collapse-tags
                                    placeholder="请选择"
                                >
                                    <el-option
                                        v-for="itme in computedAlertControlGrade"
                                        :key="itme.dictKey"
                                        :value="itme.dictKey"
                                        :label="itme.dictKeyName"
                                    ></el-option>
                                </el-select>
                                <span style="margin-left: 8px">生效日期</span>
                                <el-date-picker
                                    class="left-input2"
                                    v-model="selectData.beginDate"
                                    type="date"
                                    format="yyyy-MM-dd"
                                    value-format="yyyyMMdd"
                                    size="mini"
                                    style="width: 133px"
                                ></el-date-picker>
                            </div>
                            <div class="divs-right">
                                <span>失效日期</span>
                                <el-date-picker
                                    class="ringt-input"
                                    v-model="selectData.endDate"
                                    type="date"
                                    format="yyyy-MM-dd"
                                    value-format="yyyyMMdd"
                                    size="mini"
                                    style="width: 140px"
                                ></el-date-picker>
                            </div>
                        </div>
                        <div class="divs">
                            <div class="divs-left">
                                <span>基金账户</span>
                                <el-select
                                    class="left-input2"
                                    v-model="selectData.accountControlValue"
                                    size="mini"
                                    multiple
                                    filterable
                                    clearable
                                    collapse-tags
                                    placeholder="请选择"
                                    remote
                                    :remote-method="getstockCodeList"
                                >
                                    <el-option v-for="itme in computedAccountList" :key="itme.id" :value="itme.id" :label="itme.label"></el-option>
                                </el-select>
                                <span style="margin-left: 8px">{{ SHOW_SECURITY ? '投资组合' : '条目来源' }}</span>
                                <el-select
                                    style="width: 133px"
                                    v-model="selectData.sourceType"
                                    size="mini"
                                    multiple
                                    collapse-tags
                                    placeholder="请选择"
                                    v-show="!SHOW_SECURITY"
                                >
                                    <el-option
                                        v-for="item in computedSourceTypes"
                                        :key="item.dictKey"
                                        :value="item.dictKey"
                                        :label="item.dictKeyName"
                                    ></el-option>
                                </el-select>
                                <el-select
                                    style="width: 133px"
                                    v-model="selectData.fdAcCodeControlValue"
                                    size="mini"
                                    multiple
                                    filterable
                                    :filter-method="filterMethodFdAc"
                                    @visible-change="handleVisibleChange"
                                    clearable
                                    collapse-tags
                                    placeholder="请选择"
                                    v-show="SHOW_SECURITY"
                                >
                                    <el-option
                                        v-for="itme in computedFilterfdAcList"
                                        :key="itme.fundAccountCode"
                                        :value="itme.fundAccountCode"
                                        :label="itme.fundAccountCode + '-' + itme.fundAccountName"
                                    ></el-option>
                                </el-select>
                            </div>
                            <div class="divs-right">
                                <span>{{ SHOW_SECURITY ? '资产单元' : '风险类型' }}</span>
                                <el-select
                                    class="ringt-input"
                                    v-model="selectData.entryTypes"
                                    size="mini"
                                    multiple
                                    collapse-tags
                                    placeholder="请选择"
                                    v-show="!SHOW_SECURITY"
                                >
                                    <el-option
                                        v-for="itme in computedEntryTypeList"
                                        :key="itme.dictKey"
                                        :value="itme.dictKey"
                                        :label="itme.dictKeyName"
                                    ></el-option>
                                </el-select>
                                <el-select
                                    style="width: 133px"
                                    v-model="selectData.assetCodeControlValue"
                                    size="mini"
                                    multiple
                                    filterable
                                    :filter-method="filterMethodAsset"
                                    @visible-change="handleVisibleChange"
                                    clearable
                                    collapse-tags
                                    placeholder="请选择"
                                    v-show="SHOW_SECURITY"
                                >
                                    <el-option
                                        v-for="itme in computedFilterAssetList"
                                        :key="itme.assetCode"
                                        :value="itme.assetCode"
                                        :label="itme.assetCode + '-' + itme.assetName"
                                    ></el-option>
                                </el-select>
                            </div>
                        </div>
                        <div class="divs" v-show="SHOW_SECURITY">
                            <div class="divs-left">
                                <span>条目来源</span>
                                <el-select class="left-input2" v-model="selectData.sourceType" size="mini" multiple collapse-tags placeholder="请选择"
                                    ><el-option
                                        v-for="item in computedSourceTypes"
                                        :key="item.dictKey"
                                        :value="item.dictKey"
                                        :label="item.dictKeyName"
                                    ></el-option>
                                </el-select>

                                <span style="margin-left: 8px"> 风险类型</span>
                                <el-select
                                    style="width: 133px"
                                    v-model="selectData.entryTypes"
                                    size="mini"
                                    multiple
                                    collapse-tags
                                    placeholder="请选择"
                                >
                                    <el-option
                                        v-for="itme in computedEntryTypeList"
                                        :key="itme.dictKey"
                                        :value="itme.dictKey"
                                        :label="itme.dictKeyName"
                                    ></el-option>
                                </el-select>
                            </div>
                            <!-- <div class="divs-right">
                                <span>资产单元</span>
                                <el-select
                                    class="ringt-input"
                                    v-model="selectData.assetCodeControlValue"
                                    size="mini"
                                    multiple
                                    filterable
                                    clearable
                                    collapse-tags
                                    placeholder="请选择"
                                >
                                    <el-option v-for="itme in accountList" :key="itme.id" :value="itme.id" :label="itme.label"></el-option>
                                </el-select>
                            </div> -->
                        </div>
                        <div class="divs">
                            <div class="divs-left">
                                <span>&nbsp;&nbsp;&nbsp;条目组</span>
                                <el-select
                                    style="margin-left: 1px; width: 195px"
                                    v-model="selectData.entryGroups"
                                    size="mini"
                                    multiple
                                    collapse-tags
                                    placeholder="请选择"
                                >
                                    <el-option
                                        v-for="itme in computedEntryGroupsList"
                                        :key="itme.dictKey"
                                        :value="itme.dictKey"
                                        :label="itme.dictKey + itme.dictKeyName"
                                    ></el-option>
                                </el-select>
                                <el-checkbox
                                    size="mini"
                                    style="margin-left: 8px; width: 132px"
                                    v-model="selectData.excludeEntryGroup"
                                    label="排除选中"
                                    border
                                ></el-checkbox>
                            </div>
                            <div class="divs-right">
                                <span>条目角色</span>
                                <el-select
                                    class="ringt-input"
                                    v-model="selectData.entryRoleCode"
                                    size="mini"
                                    multiple
                                    collapse-tags
                                    placeholder="请选择"
                                >
                                    <el-option
                                        v-for="itme in computedEntryRoleList"
                                        :key="itme.dictKey"
                                        :value="itme.dictKey"
                                        :label="itme.dictKeyName"
                                    ></el-option>
                                </el-select>
                            </div>
                        </div>
                        <div class="divs">
                            <div class="divs-left1">
                                <span>自定义分类</span>
                                <el-select
                                    class="divs-left-input1"
                                    v-model="selectData.customType"
                                    size="mini"
                                    multiple
                                    collapse-tags
                                    placeholder="请选择"
                                >
                                    <el-option
                                        v-for="itme in computedCustomTypesList"
                                        :key="itme.dictKey"
                                        :value="itme.dictKey"
                                        :label="itme.dictKeyName"
                                    ></el-option>
                                </el-select>
                            </div>
                            <div class="divs-right">
                                <span>条目标签</span>
                                <el-select class="ringt-input" v-model="selectData.tagIds" size="mini" multiple collapse-tags placeholder="请选择">
                                    <el-option
                                        v-for="itme in computedEntryTagIdList"
                                        :key="itme.dictKey"
                                        :value="itme.dictKey"
                                        :label="itme.dictKeyName"
                                    ></el-option>
                                </el-select>
                            </div>
                        </div>
                    </div>
                    <div slot="footer" class="dialog-footer">
                        <el-button size="mini" @click="controlReset">重置</el-button>
                        <el-button size="mini" @click="lookControls = false">取 消</el-button>
                        <el-button size="mini" type="primary" @click="selectDatas">确 定 </el-button>
                    </div>
                </yh-dialog>
                <!-- 启用禁用 -->
                <yh-dialog :title="dialogTitle" :visible.sync="lookCheck" width="600px" v-loading="loading" drag>
                    <div>
                        {{ stateLists.map(item => item).join(',') }}
                    </div>
                    <div slot="footer" class="dialog-footer">
                        <el-button size="mini" @click="lookCheck = false">取 消</el-button>
                        <el-button size="mini" type="primary" @click="resetStatel">确 定 </el-button>
                    </div>
                </yh-dialog>

                <!-- 删除 -->
                <yh-dialog title="确定删除以下条目吗？" :visible.sync="deleteCheck" width="600px" v-loading="loading" drag>
                    <div>
                        {{ selectedList.map(item => item).join(',') }}
                    </div>
                    <div slot="footer" class="dialog-footer">
                        <el-button size="mini" @click="deleteCheck = false">取 消</el-button>
                        <el-button size="mini" type="primary" @click="deleteControl()">确 定 </el-button>
                    </div>
                </yh-dialog>
                <yh-dialog title="条目添加组" :visible.sync="entryVisible" width="800px" v-loading="loading" class="editDialog" drag>
                    <RiskTrantableCheck
                        ref="entryVisibleRef"
                        leftPlaceholder="条目编号/风险说明"
                        rightPlaceholder="条目组编号/条目组名称"
                        :leftColumns="entryColmens"
                        :leftTableData="leftTranData"
                        :rightTableData="entryColmensList"
                        indexKey="entryCode"
                        @set-table-data="getEntrydata"
                        :leftSearchNames="['entryCode', 'entryName']"
                    />
                    <div slot="footer" class="dialog-footer">
                        <el-button size="mini" @click="entryVisible = false"> 取 消 </el-button>
                        <el-button size="mini" type="primary" @click="entryUserclick">确 定 </el-button>
                    </div>
                </yh-dialog>
                <yh-dialog title="条目赋权" :visible.sync="empowermentVisible" width="800px" v-loading="loading" class="editDialog" drag>
                    <RiskTrantableCheck
                        ref="empowermentVisibleRef"
                        leftPlaceholder="条目编号/风险说明"
                        rightPlaceholder="条目组编号/条目组名称"
                        :leftColumns="leftEmpowermentColmens"
                        :rightColumns="rightEmpowermentColumns"
                        :leftTableData="leftTranData"
                        :rightTableData="rigthTranData"
                        indexKey="entryCode"
                        RightindexKey="entryRoleCode"
                        @set-table-data="getEmpowermentdata"
                        :leftSearchNames="['entryCode', 'entryName']"
                        :rightSearchNames="['entryRoleCode', 'entryRoleName']"
                    />
                    <div slot="footer" class="dialog-footer">
                        <el-button size="mini" @click="empowermentVisible = false"> 取 消 </el-button>
                        <el-button size="mini" type="primary" @click="empowermentClick">确 定 </el-button>
                    </div>
                </yh-dialog>
                <!-- 导入条目 -->
                <yh-dialog
                    title="导入条目"
                    :visible.sync="putVisible"
                    width="800px"
                    :before-close="closePut"
                    v-loading="loading"
                    class="editDialog"
                    drag
                >
                    <div>
                        <el-button @click="putControlfile" type="primary" style="margin-bottom: 5px">选择文件</el-button><i> {{ fileNames }} </i>
                        <input type="file" :key="retunUUID" ref="putInput" accept=".json" style="display: none" @change="putDictfiles" />
                        <div>
                            <el-radio v-model="importEntry" label="1">全量导入</el-radio>
                            <el-radio v-model="importEntry" label="2">覆盖导入</el-radio>
                        </div>
                    </div>
                    <el-table :data="putContorData" tooltip-effect="dark" style="width: 100%" height="360px" border size="mini">
                        <el-table-column label="条目编号" prop="entryCode" width="100">
                            <template slot-scope="scope">
                                {{ scope.row.entryControl.entryCode }}
                            </template>
                        </el-table-column>
                        <el-table-column label="风险说明" prop="entryName" show-overflow-tooltip>
                            <template slot-scope="scope">
                                {{ scope.row.entryControl.entryName }}
                            </template>
                        </el-table-column>
                        <el-table-column label="风险类型" prop="entryType" width="100">
                            <template slot-scope="scope">
                                <span v-html="getTableParamShow(scope.row.entryControl, 'entryType')"></span>
                            </template>
                        </el-table-column>
                        <el-table-column label="条目状态" prop="entryStatusValid" width="100">
                            <template slot-scope="scope">
                                <span v-if="scope.row.entryControl.entryStatusValid"> 启用</span>
                                <span v-else>禁用</span>
                            </template>
                        </el-table-column>
                    </el-table>
                    <div slot="footer" class="dialog-footer">
                        <el-button size="mini" @click="closePut"> 取 消 </el-button>
                        <el-button size="mini" type="primary" @click="putControlRequest">确 定 </el-button>
                    </div>
                </yh-dialog>
                <!-- 条目复核提示 -->
                <yh-dialog title="提示" :visible.sync="editCheckTip" width="300px" v-loading="loading" drag>
                    <div>
                        <div>已存在该风控未复核记录!</div>
                        <div>确定要修改选中的风控设置记录吗？</div>
                    </div>
                    <div slot="footer" class="dialog-footer">
                        <el-button size="mini" @click="editCheckTip = false">取 消</el-button>
                        <el-button size="mini" type="primary" @click="addTabs('editCheckSetting', modifyData)">确 定 </el-button>
                    </div>
                </yh-dialog>
                <div>
                    <el-drawer :visible.sync="drawer" :title="drawerName" direction="btt" :before-close="handleClose" size="40%">
                        <div class="aletr-tbale">
                            <el-table :data="mutextableData" tooltip-effect="dark" style="width: 100%" height="200px" border size="mini">
                                <el-table-column label="条目编号" width="120" prop="entryCode" fixed="left" show-overflow-tooltip> </el-table-column>
                                <el-table-column
                                    label="关联类型"
                                    width="120"
                                    prop="relationType"
                                    fixed="left"
                                    show-overflow-tooltip
                                ></el-table-column>
                                <el-table-column
                                    v-for="col in Columns"
                                    :key="col.prop"
                                    :prop="col.prop"
                                    :label="col.title"
                                    :width="col.width"
                                    show-overflow-tooltip
                                >
                                    <template slot-scope="scope">
                                        <span v-if="col.funcBody"> {{ col.funcBody(scope.row[col.prop], scope.row) }} </span>
                                        <span v-else v-html="getTableParamShow(scope.row, col.prop)"></span>
                                    </template>
                                </el-table-column>
                            </el-table>
                        </div>
                    </el-drawer>
                </div>
            </div>
        </div>
        <RiskTableLayout
            title="页面布局"
            :visible.sync="layoutDialog"
            :field-list="SHOW_SECURITY ? Columns.concat(otherTableColumns) : Columns"
            :selected-field-list="selectedFieldList"
            :fixed-field-list="fixedFieldList"
            table-name="RISK_ENTRT_CONTROL"
            @on-submit="onSubmit"
        />
    </div>
</template>
<script lang="ts">
import { Component, Prop, Vue, Watch } from 'vue-property-decorator';
import DictionConstUtil, { SGU_CACHE } from '@/utils/diction-const-util';
import RiskIconButton from '@/common/components/risk-icon-button.vue';
import { mixins } from 'vue-class-component';
import RiskEmitter from '@/common/mixis/risk-emitter.vue';
import { downLoadFile } from '@/utils/request';
import RiskTrantableCheck from '@/common/components/risk-trantable-check.vue';
import RiskTableLayout from '@/common/components/risk-table-layout.vue';
import RiskEntryInput from '@/common/components/risk-entry-input.vue';
import { UUID, timeFormat, numberFormat, unitShow, getConfigItem, changeOptions } from '@/utils/tools';
import { queryEntryCodesByStatus } from '@/pages/setting/api';
import { IUserInfo, UserModule } from '@/store/modules/user';
import RiskPagination from '@/common/components/risk-pagination.vue';

@Component({
    name: 'RiskControl',
    components: {
        RiskIconButton,
        RiskTrantableCheck,
        RiskTableLayout,
        RiskEntryInput,
        RiskPagination,
    },
})
export default class RiskControl extends mixins(RiskEmitter) {
    @Prop() tabsIndex!: any;
    SHOW_SECURITY = getConfigItem('SHOW_SECURITY');

    timeFormat = timeFormat;
    tableData: any[] = [];
    Columns: any[] = [
        {
            title: '风险说明',
            prop: 'entryName',
            minWidth: 250,
            tooltip: false,
        },
        {
            title: '变动序号',
            prop: 'changeNo',
            tooltip: false,
        },
        {
            title: '风险类型',
            prop: 'entryType',
            minWidth: 130,
            tooltip: false,
        },
        {
            title: '生效日期',
            prop: 'beginDate',
        },
        {
            title: '失效日期',
            prop: 'endDate',
        },
        {
            title: '优先级',
            prop: 'level',
        },
        {
            title: '状态',
            prop: 'entryStatusValid',
        },
        {
            title: '风险等级',
            prop: 'controlGrade',
        },
        {
            title: '作用范围',
            prop: 'riskCalTypes',
        },
        {
            title: '阈值类型1',
            prop: 'thresholdType1',
            minWidth: 120,
        },
        {
            title: '阈值1',
            prop: 'thresholdValue1',
            minWidth: 150,
            funcBody: (value, record) => (value ? this.thresholdTypeFormat(value, record.unit) : ''),
        },
        {
            title: '阈值类型2',
            prop: 'thresholdType2',
            minWidth: 120,
        },
        {
            title: '阈值2',
            prop: 'thresholdValue2',
            minWidth: 150,
            funcBody: (value, record) => (value ? this.thresholdTypeFormat(value, record.unit) : ''),
        },
        {
            title: '阈值类型3',
            prop: 'thresholdType3',
            minWidth: 120,
        },
        {
            title: '阈值3',
            prop: 'thresholdValue3',
            minWidth: 150,
            funcBody: (value, record) => (value ? this.thresholdTypeFormat(value, record.unit) : ''),
        },
        {
            title: '静态控制值',
            prop: 'saThresholdValue',
            minWidth: 150,
            funcBody: (value, record) => (value ? this.thresholdTypeFormat(value, record.unit) : ''),
        },
        // {
        //     title: '静态触警操作',
        //     prop: 'saThresholdType',
        //     minWidth: 180,
        // },
        {
            title: '比较方向',
            prop: 'compareType',
        },
        {
            title: '账户层次',
            prop: 'originalAccountId',
            minWidth: 150,
        },
        {
            title: '控制类型',
            prop: 'accountControlType',
            minWidth: 150,
        },
        {
            title: '控制账户',
            prop: 'accountControlValue',
            minWidth: 150,
        },
        {
            title: '排除账户',
            prop: 'accountDebarValue',
            minWidth: 120,
        },
        {
            title: '排除账户组',
            prop: 'accountGroupDebarValue',
            minWidth: 150,
        },

        {
            title: '修改日期',
            prop: 'modifyDate',
            minWidth: 180,
        },
        // {
        //     title: '修改时间',
        //     prop: 'modifyTime',
        // },
        {
            title: '修改人',
            prop: 'modifyUser',
            minWidth: 150,
        },
        {
            title: '条目来源',
            prop: 'sourceType',
        },
        {
            title: '自定义分类',
            prop: 'customType',
            minWidth: 140,
        },
        {
            title: '条目角色分类',
            prop: 'entryRoleCode',
            minWidth: 180,
            tooltip: false,
        },
        {
            title: '备注',
            prop: 'content',
            minWidth: 150,
        },
    ];

    otherTableColumns: any[] = [
        {
            title: '排除资产单元',
            prop: 'assetCodeDebarValue',
            minWidth: 120,
        },
        {
            title: '排除资产单元组',
            prop: 'assetGroupDebarValue',
            minWidth: 150,
        },
        {
            title: '排除投资组合',
            prop: 'fdAcCodeDebarValue',
            minWidth: 120,
        },
        {
            title: '排除投资组合组',
            prop: 'fdAcGroupDebarValue',
            minWidth: 150,
        },
    ];

    // 条目添加组
    entryColmens: any[] = [
        {
            label: '编号',
            prop: 'entryCode',
            width: 70,
        },
        {
            label: '名称',
            prop: 'entryName',
        },
    ];

    // 条目赋权
    leftEmpowermentColmens: any[] = [
        {
            label: '编号',
            prop: 'entryCode',
            width: 70,
        },
        {
            label: '名称',
            prop: 'entryName',
        },
    ];
    rightEmpowermentColumns = [
        {
            label: '编号',
            prop: 'entryRoleCode',
            width: 70,
        },
        {
            label: '名称',
            prop: 'entryRoleName',
        },
    ];

    loading: boolean = false;
    tabloading: boolean = false;
    lookCheck: boolean = false;
    deleteCheck: boolean = false;
    editCheckTip: boolean = false;
    selectedList: any[] = [];
    selettedTypes: any = '';
    dialogTitle: string = '';
    lookControls: boolean = false; // 查询弹窗
    entryVisible: boolean = false;
    empowermentVisible: boolean = false;
    settingInfo: any[] = [];
    controlData: string = ''; // 产品名称
    showLocality: boolean = false; // 是否显示本地
    sortProp: string = 'entryName';
    sortOrder: string = 'desc'; // 排序方式
    treeData: any[] = [
        // 条目列表
        {
            id: '-1',
            label: '全部选择',
            children: [],
        },
    ];
    treeTypeData: any[] = [
        // 风险类别
        {
            id: '-1',
            label: '全部选择',
            children: [],
        },
    ];
    paging: any = {
        total: 0,
        currentPage: 1,
        totalPage: 0,
        pageSize: 25,
    };
    sorter: any = {
        entryCode: 'descend',
    };
    entryCodeLits: string = '';
    selectData: any = {
        entryCode: [], // 条目编号
        precision: false, // 准确搜索
        riskCalTypes: [], // 作用范围
        entryName: '', // 风险说明
        entryStatuss: [], // 启用状态
        controlGrades: [], // 风险等级
        beginDate: '', // 生效日期
        endDate: '', // 失效日期
        accountControlValue: [], // 基金账户
        sourceType: [], // 条目来源
        entryTypes: [], // 风险类型
        entryGroups: [], // 条目组
        excludeEntryGroup: false, // 排除选中
        customType: [], // 自定义分类
        checkUserCodes: '', // 复核人
        checkTableDataDirection: '', // 复核时间
        entryRoleCode: [], // 条目角色
        sort: '', // 排序字段
        fdAcCodeControlValue: [],
        assetCodeControlValue: [],
        tagIds: [], // 条目标签
        sourceCode_: [], // 关联来源
        termCode_: [], // 关联条款
    };
    prams: any = {
        accountControlValue: [],
        entryTypes: [],
        sourceType: [],
    };
    alertControlGrade: any[] = [];
    accountList: any[] = [];
    EntryTypeList: any[] = [];
    customTypesList: any[] = [];
    EntryRoleList: any[] = [];
    entryGroupsList: any[] = [];
    entryColmensList: any[] = [];
    leftTranData: any[] = [];
    rigthTranData: any[] = [
        { key: '001', entryRoleCode: '001', entryRoleName: '风控' },
        { key: '002', entryRoleCode: '002', entryRoleName: '投资' },
        { key: '003', entryRoleCode: '003', entryRoleName: '交易' },
        { key: '004', entryRoleCode: '004', entryRoleName: '合规风险' },
    ];
    fundGroups: any[] = [];
    funds: any[] = [];
    cutomTypes: any = null;
    entryTagIdList: any[] = []; // 条目标签下拉值
    sourceCodeList: any[] = [];
    termCodeList: any[] = [];
    EntryRLdata: any = {};
    Empowerment: any = {};
    stateLists: any[] = [];
    drawer: boolean = false;
    mutextableData: any[] = [];
    layoutDialog: boolean = false;
    // 已选择字段列表
    selectedFieldList: any[] = [];
    // 固定字段列表
    fixedFieldList: any[] = [
        { content: '条目编号', id: 'entryCode', sortable: true },
        { content: '操作', id: '', sortable: false },
    ];
    showFieldList: any[] = [];
    showColumns: any[] = [];
    drawerName: string = '';
    putVisible: boolean = false;
    fileNames: string = '';
    importEntry: string = '1';
    putContorData: any[] = [];
    ConstUtil: DictionConstUtil;
    retunUUID: string = '-1';
    modifyData: any = {}; // 未复核条目数据存储
    entryCodeChoice: any = '';
    fundsEnum: any = {};
    fundGroupsEnum: any = {};

    // 排序字段
    sortParamObj = {
        entryName: 'C_ENTRY_NAME',
        changeNo: 'N_CHANGE_NO',
        entryType: 'N_RISK_TYPE_ID',
        beginDate: 'D_BEGIN_DATE',
        endDate: 'D_END_DATE',
        level: 'N_LEVEL',
        entryStatusValid: 'C_ENTRY_STATUS',
        controlGrade: 'C_CONTROL_GRADE',
        riskCalTypes: 'C_RISK_CAL_TYPES',
        thresholdType1: 'C_THRESHOLD_TYPE1',
        thresholdValue1: 'N_THRESHOLD_VALUE1',
        thresholdType2: 'C_THRESHOLD_TYPE2',
        thresholdValue2: 'N_THRESHOLD_VALUE2',
        thresholdType3: 'C_THRESHOLD_TYPE3',
        thresholdValue3: 'N_THRESHOLD_VALUE3',
        compareType: 'C_COMPARE_TYPE',
        originalAccountId: 'N_OR_AC_ID',
        accountControlType: 'C_AC_CONTROL_TYPE',
        accountControlValue: 'C_AC_CONTROL_VALUE',
        accountDebarValue: 'C_AC_DEBAR_VALUE',
        accountGroupDebarValue: 'C_AC_GR_DEBAR_VALUE',
        modifyDate: 'CONCAT(D_MODIFY_DATE,D_MODIFY_TIME)',
        modifyTime: 'D_MODIFY_TIME',
        modifyUser: 'C_MODIFY_USER',
        sourceType: 'C_SOURCE_TYPE',
        customType: 'C_CUSTOM_TYPE',
        entryRoleCode: 'C_ENTRY_ROLE_CODE',
        assetCodeDebarValue: 'C_AT_DEBAR_VALUE',
        assetGroupDebarValue: 'C_AT_GR_DEBAR_VALUE',
        fdAcCodeDebarValue: 'C_FD_AC_CODE_DEBAR_VALUE',
        fdAcGroupDebarValue: 'C_FD_AC_GR_DEBAR_VALUE',
        saThresholdValue: 'N_SA_THRESHOLD_VALUE',
        saThresholdType: 'C_SA_THRESHOLD_TYPE',
        content: 'C_CONTENT',
    };

    // 条目来源下拉数据
    sourceTypes: any[] = [
        { dictKey: '1', dictKeyName: '本地' },
        { dictKey: '2', dictKeyName: '恒生-主动' },
        { dictKey: '3', dictKeyName: '恒生-被动' },
    ];

    get userInfo(): IUserInfo {
        return UserModule.userInfo;
    }

    get urlH() {
        return '/entry';
    }

    created() {
        this.Columns.forEach(item => {
            item.id = item.prop;
            item.content = item.title;
        });
        this.queryLayout();
        this.getRiskEntry(this.paging, this.sorter, this.prams);
    }
    assetList: any = [];
    fdAcList: any[] = [];

    selectData1: any = { data: [], label: 'label', value: 'fundCode' };

    async mounted() {
        if (this.SHOW_SECURITY) {
            this.$axios.get('/asset/list/byFundCode').then((res: any) => {
                this.assetList = res;
                this.filterAssetList = res;
            });
            this.$axios.get('/fdAc/list/byFundCode').then((res: any) => {
                this.fdAcList = res;
                this.filterfdAcList = res;
            });
        }
        // 条目数据
        let fubds = await SGU_CACHE('FundInfoByUser', '/fundInfo/list/byUser/like', []);
        let local = [];
        for (let itme of fubds) {
            let datas = itme.fundCode + '-' + itme.fundName;
            local.push({ label: datas, id: itme.fundCode, fundCode: itme.fundCode });
        }
        // 基金账户
        this.accountList = local;
        this.treeData[0].children = local;
        // this.settingInfo = local;
        this.selectData1.data = local;

        // 风险类别数据
        let entryType = await SGU_CACHE('EntryType', '/entry/entryType', []);
        let typeLocal = [];
        for (let itme of entryType) {
            let datas = itme.entryTypeId + ' ' + itme.entryTypeName;
            typeLocal.push({ label: datas, id: itme.entryTypeId });
        }
        this.treeTypeData[0].children = typeLocal;

        this.Columns.forEach(item => {
            item.id = item.prop;
            item.content = item.title;
        });
        this.SHOW_SECURITY &&
            this.otherTableColumns.forEach(item => {
                item.id = item.prop;
                item.content = item.title;
            });
        // this.showColumns = this.Columns;
        // 获取条目数据
        // 风险等级
        this.alertControlGrade = DictionConstUtil.PojoToList(DictionConstUtil.ControlGrade);
        // 风险类型
        this.EntryTypeList = DictionConstUtil.PojoToList(DictionConstUtil.EntryType);
        // 自定义风险
        this.customTypesList = (await DictionConstUtil.FNCustomType()) || [];
        // 条目角色
        this.EntryRoleList = DictionConstUtil.PojoToList(DictionConstUtil.EntryRole);
        // 条目组
        this.getGroupList();
        this.funds = (await DictionConstUtil.FNFundInfo()) || [];
        // 产品组信息
        this.fundGroups = (await DictionConstUtil.FNFundGroup()) || [];
        // 自定义风险分类
        this.cutomTypes = DictionConstUtil.ListToPojo(this.customTypesList || []) || {};

        this.$axios.get('/entryTag/queryAll').then((res: any) => {
            this.entryTagIdList = res;
        });

        // this.$axios.get('/todo/url').then((res: any) => {
        //     this.sourceCodeList = res;
        // });
        // this.$axios.get('/todo/url').then((res: any) => {
        //     this.termCodeList = res;
        // });

        // 设置枚举 用于转义
        this.fundsEnum = DictionConstUtil.ListToPojo3('fundCode', this.funds, 'fundNameSt');
        this.fundGroupsEnum = DictionConstUtil.ListToPojo3('fundGroupCode', this.fundGroups, 'fundGroupName');
        // -1 也在展示范围内
        this.fundsEnum['-1'] = '全部选择';
        this.fundGroupsEnum['-1'] = '全部选择';
        console.log(this.fundsEnum, this.fundGroupsEnum, '---------------');
    }

    // 风险等级已选项前置
    get computedAlertControlGrade() {
        let alertControlGrade = changeOptions(this.selectData.controlGrades, this.alertControlGrade, 'dictKey');
        return alertControlGrade;
    }

    // 基金账户已选项前置
    get computedAccountList() {
        let accountList = changeOptions(this.selectData.accountControlValue, this.accountList, 'id');
        return accountList;
    }

    // 投资组合已选项前置
    get computedFilterfdAcList() {
        let filterfdAcList = changeOptions(this.selectData.fdAcCodeControlValue, this.filterfdAcList, 'fundAccountCode');
        return filterfdAcList;
    }

    // 风险类型已选项前置
    get computedEntryTypeList() {
        let EntryTypeList = changeOptions(this.selectData.entryTypes, this.EntryTypeList, 'dictKey');
        return EntryTypeList;
    }

    // 资产单元已选项前置
    get computedFilterAssetList() {
        let filterAssetList = changeOptions(this.selectData.assetCodeControlValue, this.filterAssetList, 'id');
        return filterAssetList;
    }

    // 条目来源已选项前置
    get computedSourceTypes() {
        let sourceTypes = changeOptions(this.selectData.sourceType, this.sourceTypes, 'dictKey');
        return sourceTypes;
    }

    // 条目组已选项前置
    get computedEntryGroupsList() {
        let entryGroupsList = changeOptions(this.selectData.entryGroups, this.entryGroupsList, 'dictKey');
        return entryGroupsList;
    }

    // 条目角色已选项前置
    get computedEntryRoleList() {
        let EntryRoleList = changeOptions(this.selectData.entryRoleCode, this.EntryRoleList, 'dictKey');
        return EntryRoleList;
    }

    // 自定义分类已选项前置
    get computedCustomTypesList() {
        let customTypesList = changeOptions(this.selectData.customType, this.customTypesList, 'dictKey');
        return customTypesList;
    }

    // 条目标签已选项前置
    get computedEntryTagIdList() {
        let entryTagIdList = changeOptions(this.selectData.tagIds, this.entryTagIdList, 'dictKey');
        return entryTagIdList;
    }

    // 关联来源已选项前置
    get computedSourceCode() {
        let sourceCodeList = changeOptions(this.selectData.sourceCode_, this.sourceCodeList, 'dictKey');
        return sourceCodeList;
    }

    // 关联条款已选项前置
    get computedTermCode() {
        let termCodeList = changeOptions(this.selectData.termCode_, this.termCodeList, 'dictKey');
        return termCodeList;
    }

    // 操作行高亮
    isRed({ row }) {
        if (row.entryCode == this.entryCodeChoice) {
            return {
                backgroundColor: '#b4e4fe',
            };
        }
    }

    // 获取页面布局信息
    async queryLayout() {
        const name = 'RISK_ENTRT_CONTROL';
        let resList: any = await new Promise((resolve, reject) => {
            this.$axios('/tableLayout/query/' + name)
                .then((res: any) => {
                    resolve(res);
                })
                .catch(err => {
                    reject(err);
                });
        });
        if (resList) {
            if (this.SHOW_SECURITY) {
                this.selectedFieldList = JSON.parse(resList);
            } else {
                let columns = [];
                JSON.parse(resList).forEach(i => {
                    if (!['assetCodeDebarValue', 'assetGroupDebarValue', 'fdAcCodeDebarValue', 'fdAcGroupDebarValue'].includes(i.prop)) {
                        columns.push(i);
                    }
                });
                this.selectedFieldList = columns;
            }
        } else {
            this.selectedFieldList = this.SHOW_SECURITY ? this.Columns.concat(this.otherTableColumns) : this.Columns;
        }
    }

    @Watch('selectedFieldList')
    onChangselectedFieldList() {
        let columns = this.SHOW_SECURITY ? this.Columns.concat(this.otherTableColumns) : this.Columns;
        if (this.selectedFieldList.length == 0) {
            this.showColumns = columns;
        } else {
            this.showColumns = this.selectedFieldList;
            console.log(this.showColumns, 'showColumns');
        }
        for (let i = 0; i < this.showColumns.length; i++) {
            if (
                this.showColumns[i].prop == 'entryRoleCode' ||
                this.showColumns[i].prop == 'accountControlValue' ||
                this.showColumns[i].prop == 'accountDebarValue' ||
                this.showColumns[i].prop == 'accountGroupDebarValue' ||
                this.showColumns[i].prop == 'originalAccountId' ||
                this.showColumns[i].prop == 'entryName'
            ) {
                this.showColumns[i].tooltip = true;
            } else {
                this.showColumns[i].tooltip = false;
            }
        }
    }

    // 获取产品码
    getEntryslist(val: any) {
        this.controlData = val;
        this.productType(val);
    }

    // 导出excl and json
    private handleCommand(val: string): void {
        let itemsO32 = this.selectedList.filter((item: any) => {
            const value = item.replace(/^(UFX).*/g, '');
            return !value;
        });
        if (itemsO32.length > 0) {
            this.yh_message_error('调用O32接口计算的条目不提供导出功能');
            return;
        }
        if (val === 'Excel') {
            downLoadFile({
                url: this.urlH + '/list/export',
                method: 'post',
                data: {
                    riskEntryControlQuery: this.selectData,
                    exportEntryCode: this.selectedList,
                    sorter: this.sorter,
                },
                loading: true,
                loadingMsg: '正在准备导出，请稍后··· ···',
            });
        } else {
            downLoadFile({
                url: this.urlH + '/list/export/json',
                method: 'post',
                data: {
                    riskEntryControlQuery: this.selectData,
                    exportEntryCode: this.selectedList,
                    sorter: this.sorter,
                },
                loading: true,
                loadingMsg: '正在准备导出，请稍后··· ···',
            });
        }
    }

    @Watch('tabsIndex', { immediate: true, deep: true })
    watchEdittabes() {
        if (this.tabsIndex > 0) {
            this.getRiskEntry(this.paging, this.sorter, this.selectData);
        }
    }

    // 回调函数
    addTabs(data: any, val: any) {
        let datas: any = {};
        datas.type = data;
        datas.value = val;
        this.editCheckTip = false;
        this.dispatch('ItemSetting', 'addTables', datas);
    }

    getEditType(row) {
        // this.modifyData = {};
        if (row.modifyStatus == '1') {
            this.editCheckTip = true;
            this.modifyData = row;
            this.$nextTick(() => {
                this.entryCodeChoice = row.entryCode;
            });
            // this.addTabs('editCheck', row)
        } else {
            this.addTabs('edit', row.entryCode);
            this.$nextTick(() => {
                this.entryCodeChoice = row.entryCode;
            });
        }
    }

    lookData(val) {
        if (val.modifyStatus == '1' && val.modifyType == '1') {
            let data = {
                entryCode: val.entryCode,
                serialNo: val.serialNo,
                changeNo: val.changeNo,
            };
            this.addTabs('check-look', data);
            this.$nextTick(() => {
                this.entryCodeChoice = val.entryCode;
            });
        } else {
            this.addTabs('look', val.entryCode);
            this.$nextTick(() => {
                this.entryCodeChoice = val.entryCode;
            });
        }
    }

    // 处理table中的数据
    getTableParamShow(data: any, props: any) {
        let datas = data[props];
        if (props == 'entryType') {
            // eslint-disable-next-line no-unused-expressions
            return DictionConstUtil.EntryType[datas];
        } else if (props == 'entryStatusValid') {
            if (data[props] == true) {
                let span = '<span style="color:green">启用</span>';
                return span;
            } else {
                let span = '<span style="color:red">禁用</span>';
                return span;
            }
        } else if (props == 'controlGrade') {
            return DictionConstUtil.ControlGrade[datas];
        } else if (props == 'riskCalTypes') {
            let result = '';
            for (let i = 0; i < datas.length; i++) {
                result += DictionConstUtil.RiskCalType[datas[i]] + ',';
            }
            return result;
        } else if (props == 'thresholdType1' || props == 'thresholdType2' || props == 'thresholdType3') {
            return DictionConstUtil.ThresholdType[datas];
        } else if (props == 'compareType') {
            return DictionConstUtil.CompareDirection[datas];
        } else if (props == 'originalAccountId') {
            return DictionConstUtil.OriginalAccountType[datas];
        } else if (props == 'accountControlType') {
            return DictionConstUtil.AccountControlType[datas];
        } else if (props == 'accountDebarValue') {
            if (datas && datas.length > 0) {
                let fundNames = datas.map(item => this.fundsEnum[item]);
                return fundNames.join(',');
            } else {
                return datas;
            }
        } else if (props == 'accountControlValue') {
            if (datas && datas.length > 0) {
                if (String(data.originalAccountId) === '0') {
                    let fundNames = datas.map(item => this.fundsEnum[item]);
                    return fundNames.join(',');
                } else {
                    let fundGroupNames = datas.map(item => this.fundGroupsEnum[item]);
                    return fundGroupNames.join(',');
                }
            } else {
                return datas;
            }
        } else if (props == 'accountGroupDebarValue') {
            if (datas && datas.length > 0) {
                if (String(data.originalAccountId) === '0') {
                    let fundNames = datas.map(item => this.fundsEnum[item]);
                    return fundNames.join(',');
                } else {
                    let fundGroupNames = datas.map(item => this.fundGroupsEnum[item]);
                    return fundGroupNames.join(',');
                }
            } else {
                return datas;
            }
        } else if (props == 'sourceType') {
            return DictionConstUtil.SourceType[datas];
        } else if (props == 'customType') {
            return this.cutomTypes[datas];
        } else if (props == 'entryRoleCode') {
            if (datas != null) {
                let entryRoleCodes = datas.split(',');
                if (entryRoleCodes.length > 0 && entryRoleCodes.length === 1) {
                    return DictionConstUtil.EntryRole[datas];
                } else {
                    let name = '';
                    for (let i = 0; i < entryRoleCodes.length; i++) {
                        name += DictionConstUtil.EntryRole[entryRoleCodes[i]] + ',';
                    }
                    return name;
                }
            }
        } else if (props == 'beginDate') {
            if (datas == '0') {
                return '';
            } else {
                return datas;
            }
        } else if (props == 'endDate') {
            if (datas == '0') {
                return '';
            } else {
                return datas;
            }
        } else if (props == 'modifyTime') {
            return timeFormat(datas);
        } else {
            return datas;
        }
    }

    // 处理table中的数据
    getTablesData(data: any, props: any) {
        // 自定义风险分类
        let datas = data[props];
        if (props == 'entryType') {
            // eslint-disable-next-line no-unused-expressions
            return DictionConstUtil.EntryType[datas];
        } else if (props == 'entryStatusValid') {
            if (data[props] == true) {
                let span = '<span style="color:green">启用</span>';
                return span;
            } else {
                let span = '<span style="color:red">禁用</span>';
                return span;
            }
        } else if (props == 'sourceType') {
            return DictionConstUtil.SourceType[datas];
        } else if (props == 'beginDate') {
            if (datas == '0') {
                return '';
            } else {
                return datas;
            }
        } else if (props == 'endDate') {
            if (datas == '0') {
                return '';
            } else {
                return datas;
            }
        } else if (props == 'modifyDate') {
            return datas + ' ' + timeFormat(data['modifyTime']);
        } else {
            return datas;
        }
    }

    // 获取条目组
    getGroupList() {
        this.$axios.get('/entry/group/list').then((res: any) => {
            res = res || [];
            for (let i = 0; i < res.length; i++) {
                this.entryGroupsList.push({ dictKey: res[i].groupCode, dictKeyName: res[i].groupName });
                this.entryColmensList.push({ entryCode: res[i].groupCode, entryName: res[i].groupName });
            }
        });
    }

    // 关联
    productType(val: any) {
        let returnData = this.accountList;
        if (val) {
            let arrNew = returnData.filter(item => item.id == val);
            this.treeData[0].children = arrNew;
        } else {
            this.treeData[0].children = this.accountList;
        }
    }

    // 全部选择操作
    dropdownClick(command: string): void {
        this.selectedList = [];
        if (command === 'all') {
            this.loading = true;
            let paging = {
                total: 0,
                currentPage: 1,
                totalPage: 0,
                pageSize: 2147483647,
            };
            let sorter = {
                entryCode: 'descend',
            };
            let riskEntryControlQuery = {};
            this.$axios
                .post(this.urlH + '/list', {
                    paging: paging,
                    sorter: sorter,
                    riskEntryControlQuery: riskEntryControlQuery,
                })
                .then((res: any) => {
                    this.loading = false;
                    let selectedList = [];
                    for (let i = 0; i < res.list.length; i++) {
                        selectedList.push(res.list[i].entryCode);
                    }
                    this.selectedList = selectedList;
                })
                .catch(() => {
                    this.loading = false;
                });
        }
    }

    // 导入
    putControlfile() {
        this.$nextTick(() => {
            (this.$refs['putInput'] as any).click();
        });
        // this.retunUUID = UUID();
    }

    // 选取文件
    private putDictfiles(e) {
        let files = e.currentTarget.files;
        new Promise((resolve, reject) => {
            let reader = new FileReader();
            if (!files || files.length === 0) {
                // eslint-disable-next-line prefer-promise-reject-errors
                reject();
            }
            reader.readAsText(files[0]);
            reader.onload = () => resolve(reader.result);
            reader.onerror = error => reject(error);
            this.retunUUID = UUID();
        }).then((res: any) => {
            try {
                let entryDetails = [];
                entryDetails = JSON.parse(res);
                if (!(entryDetails instanceof Array)) {
                    this.yh_message_error('数据格式不正确，导入失败');
                    return;
                }
                // // eslint-disable-next-line no-unneeded-ternary
                // let re = entryDetails.map(item => item.entryControl).filter(item => (item ? true : false));
                if (entryDetails.length === 0) {
                    this.yh_message_error('数据格式不正确或者数据为空，导入失败');
                    return;
                }
                this.putContorData = entryDetails;
                // this.loadPageChange(1);

                this.fileNames = files[0].name;
            } catch (e) {
                this.yh_message_warn('数据格式不正确，导入失败');
            }
        });
    }

    putControlRequest() {
        let data = this.putContorData;
        if (this.putContorData.length == 0) {
            this.yh_message_warn('未导入数据');
            return;
        }
        this.$axios
            .post(this.urlH + '/import/' + this.importEntry, data)
            .then((res: any) => {
                this.putVisible = false;
                this.getRiskEntry(this.paging, this.sorter, this.selectData);
                if (res && res.length > 0) {
                    if (res.length === data.length) {
                        this.yh_message_warn('导入失败,可能条目已被修改');
                    } else {
                        this.yh_message_warn('条目编号：' + res.join(',') + ' 导入失败,请对导入成功的条目进行复核');
                    }
                } else {
                    this.yh_message_success('导入成功，请进行复核');
                }
            })
            .catch(() => {
                this.putVisible = false;
            });
    }

    closePut() {
        this.putVisible = false;
        this.fileNames = '';
        this.putContorData = [];
    }

    // 解析条目编号
    changEntrycode(val: any) {
        if (val) {
            this.selectData.entryCode = val.split(',');
        } else {
            this.selectData.entryCode = [];
        }
    }

    /**
     * 表头排序
     */
    handleSort(column: any) {
        console.log(column, 'column');
        this.sortProp = column.prop;
        this.sortOrder = column.order;
        const sortType = column.order == 'ascending' ? 'ASC' : column.order == 'descending' ? 'DESC' : '';
        let sort = '';
        const prop = column.prop;
        if (sortType) {
            if (prop == 'entryCode') {
                if (sortType == 'DESC') {
                    sort = "TO_NUMBER(REGEXP_REPLACE(C_ENTRY_CODE,'[^0-9]','')) DESC";
                } else {
                    sort = "TO_NUMBER(REGEXP_REPLACE(C_ENTRY_CODE,'[^0-9]','')) ASC";
                }
            } else {
                sort = this.sortParamObj[prop] + ' ' + sortType;
            }
        }
        this.selectData.sort = sort;
        this.getRiskEntry(this.paging, this.sorter, this.selectData);
    }

    // 获取条目列表
    getRiskEntry(paging: any, sorter: any, selectData: any): void {
        let riskEntryControlQuery = selectData;
        if (riskEntryControlQuery.accountControlValue?.length) {
            // 如果数组里 有 且 只有 一个-1 替换成 []
            if (riskEntryControlQuery.accountControlValue.indexOf('-1') !== -1 && riskEntryControlQuery.accountControlValue.length === 1) {
                riskEntryControlQuery.accountControlValue = [];
            }
        }
        this.tabloading = true;
        this.$axios
            .post(this.urlH + '/list/handled', {
                paging: paging,
                sorter: sorter,
                riskEntryControlQuery: selectData,
            })
            .then((res: any) => {
                res.list.map((item: any) => {
                    item.key = item.entryCode;
                    return item;
                });
                this.paging.total = res.total;
                this.tableData = res.list;
                this.onChangselectedFieldList();
                this.tabloading = false;
            })
            .catch(() => {
                this.paging.total = 0;
                this.tableData = [];
                this.tabloading = false;
            });
    }

    // 翻页
    currentChange(val: any) {
        //  this.paging.currentPage = val;
        console.log(this.selectData, 'selectData');

        this.getRiskEntry(this.paging, this.sorter, this.selectData);
    }

    // 查询
    selectDatas() {
        this.selectedList = [];
        this.lookControls = false;
        this.paging = {
            total: 0,
            currentPage: 1,
            totalPage: 0,
            pageSize: 25,
        };
        this.getRiskEntry(this.paging, this.sorter, this.selectData);
    }

    // 监听关闭查询弹窗重置
    // @Watch('lookControls', { immediate: true, deep: true })
    // watchLookControl(newVal, oldVal) {
    //     if (newVal == false) {
    //         this.controlReset();
    //     }
    // }

    // 刷新
    resetData() {
        this.getRiskEntry(this.paging, this.sorter, this.selectData);
        this.$emit('refresh');
    }

    // 联合互斥
    rowClick(val: any) {
        this.drawerName = val.entryCode;
        this.$axios
            .post(this.urlH + '/relation/entry', {
                entryCode: val.entryCode,
            })
            .then((res: any) => {
                this.drawer = true;
                let b = Object.getOwnPropertyNames(res);
                if (b.length == 0) {
                    this.drawerName = val.entryCode + '    前提联合互斥无数据';
                    this.mutextableData = [];
                } else {
                    let mutualRiskEntryControls = res.mutualRiskEntryControls;
                    let joinRiskEntryControls = res.joinRiskEntryControls;
                    let premiseEntryControls = res.premiseRiskEntryControls;
                    let dataSource = [];
                    if (mutualRiskEntryControls && mutualRiskEntryControls.length > 0) {
                        mutualRiskEntryControls.forEach(element => {
                            element.relationType = '互斥';
                            dataSource.push(element);
                        });
                    }
                    if (joinRiskEntryControls && joinRiskEntryControls.length > 0) {
                        joinRiskEntryControls.forEach(element => {
                            element.relationType = '联合';
                            dataSource.push(element);
                        });
                    }
                    if (premiseEntryControls && premiseEntryControls.length > 0) {
                        premiseEntryControls.forEach(element => {
                            element.relationType = '前提';
                            dataSource.push(element);
                        });
                    }

                    this.mutextableData = dataSource;
                }
            });
    }

    // 重置
    controlReset() {
        this.selectData = {
            entryCode: [], // 条目编号
            precision: false, // 准确搜索
            riskCalTypes: [], // 作用范围
            entryName: '', // 风险说明
            entryStatuss: [], // 启用状态
            controlGrades: [], // 风险等级
            beginDate: '', // 生效日期
            endDate: '', // 失效日期
            accountControlValue: [], // 基金账户
            sourceType: [], // 条目来源
            entryTypes: [], // 风险类型
            entryGroups: [], // 条目组
            excludeEntryGroup: false, // 排除选中
            customType: [], // 自定义分类
            entryRoleCode: [], // 条目角色
            fdAcCodeControlValue: [],
            assetCodeControlValue: [],
            tagIds: [],
            sourceCode_: [], // 关联来源
            termCode_: [], // 关联条款
        };
        this.entryCodeLits = '';
    }

    // 布局
    async onSubmit(data: any) {
        this.tabloading = true;
        await this.queryLayout();
        this.tabloading = false;
    }

    // 是否显示本地
    showLocalData(): void {
        if (this.showLocality) {
            this.selectData.sourceType.push('1');
        } else {
            this.selectData.sourceType = [];
        }
        this.getRiskEntry(this.paging, this.sorter, this.selectData);
    }

    // 产品查询
    handleNodeClick(val: any): void {
        this.selectData.accountControlValue = [];
        this.selectData.accountControlValue.push(val.id);
        this.getRiskEntry(this.paging, this.sorter, this.selectData);
    }

    // 风险类别查询
    handleTypeClick(val: any): void {
        this.selectData.entryTypes = [];
        this.selectData.entryTypes.push(String(val.id));
        this.getRiskEntry(this.paging, this.sorter, this.selectData);
    }

    // 打开启用禁用状态
    async stateList(val: any) {
        this.selettedTypes = val;
        if (this.selectedList.length === 0) {
            return this.yh_message_warn('请选择条目');
        }

        this.stateLists = [];
        let messageTop = '';
        if (val == '1') {
            this.dialogTitle = '确定启用以下条目吗？';
            await queryEntryCodesByStatus('0', this.selectedList)
                .then(res => {
                    this.stateLists = res;
                })
                .catch(() => {
                    this.yh_message_error('条目启用失败，接口异常！');
                });
            messageTop = '选择的条目已是启用状态';
        } else {
            this.dialogTitle = '确定禁用以下条目吗?';
            await queryEntryCodesByStatus('1', this.selectedList)
                .then(res => {
                    this.stateLists = res;
                })
                .catch(() => {
                    this.yh_message_error('条目启用失败，接口异常！');
                });
            messageTop = '选择的条目已是禁用状态';
        }
        if (this.stateLists.length === 0) {
            this.yh_message_warn(messageTop);
            return;
        }
        this.lookCheck = true;
    }

    // 打开删除弹窗
    deleteList() {
        if (this.selectedList.length < 1) {
            this.yh_message_warn('请选择条目');
            return;
        }
        this.deleteCheck = true;
    }

    // 删除单条条目
    deleteOne(val: any) {
        this.selectedList = [];
        this.selectedList.push(val.entryCode);
        this.deleteCheck = true;
    }

    // 删除条目提交
    deleteControl() {
        this.loading = true;
        this.$axios
            .post(this.urlH + '/delete/entryControl', this.selectedList)
            .then((res: any) => {
                this.deleteCheck = false;
                this.loading = false;
                if (res.length > 0) {
                    if (this.selectedList.length === res.length) {
                        this.yh_message_warn('删除失败');
                    } else {
                        this.yh_message_warn('删除成功 但以下条目不能被操作：' + res.join(','));
                        this.selectedList = [];
                        this.getRiskEntry(this.paging, this.sorter, this.selectData);
                    }
                } else {
                    this.yh_message_success('删除成功 请进行复核');
                    this.selectedList = [];
                    this.getRiskEntry(this.paging, this.sorter, this.selectData);
                }
            })
            .catch(() => {
                this.deleteCheck = false;
                this.loading = false;
            });
    }

    // 提交启用禁用请求
    resetStatel() {
        let url = '';
        if (this.selettedTypes === '1') {
            url = this.urlH + '/enable/entryControl';
        } else {
            url = this.urlH + '/forb/entryControl';
        }
        this.loading = true;
        this.$axios
            .post(url, this.stateLists)
            .then((res: any) => {
                this.lookCheck = false;
                if (res.length > 0) {
                    this.yh_message_warn('以下条目未复核不能被操作：' + res.join(','));
                    this.getRiskEntry(this.paging, this.sorter, this.selectData);
                } else {
                    this.loading = false;
                    this.yh_message_success('操作成功 请进行复核');
                    this.selectedList = [];
                }
            })
            .catch(() => {
                this.loading = false;
                this.lookCheck = false;
            });
        this.loading = false;
    }

    // 校验
    verifyInfo(val: any) {
        let newArr = [];
        newArr.push(val);
        this.loading = true;
        this.$axios
            .post(this.urlH + '/validataEntrySql', newArr)
            .then((res: any) => {
                this.loading = false;
                if (res && res.length > 0) {
                    this.yh_message_warn('编号：' + res.join(',') + '配置有误，具体原因请查询错误日志');
                } else {
                    this.yh_message_success('配置正确');
                }
            })
            .catch(() => {
                this.loading = false;
            });
    }

    // 条目组传参
    getEntrydata(data: any) {
        this.EntryRLdata = data;
    }

    //
    getEmpowermentdata(data: any) {
        this.Empowerment = data;
    }

    // 条目组
    async openEntryVisible() {
        if (this.selectedList.length < 1) {
            this.yh_message_warn('请选择条目');
            return;
        } else {
            await this.getSelectDataFromRequest();
            this.entryVisible = true;
        }
    }

    // 赋权
    async openEmpowerment() {
        if (this.selectedList.length < 1) {
            this.yh_message_warn('请选择条目');
            return;
        } else {
            await this.getSelectDataFromRequest();
            this.empowermentVisible = true;
        }
    }

    // 条目组
    entryUserclick() {
        let data = {
            entryCodes: [], // 左边
            groupCodes: [], // 右边
        };
        for (let i = 0; i < this.EntryRLdata.leftData.length; i++) {
            data.entryCodes.push(this.EntryRLdata.leftData[i].entryCode);
        }
        for (let i = 0; i < this.EntryRLdata.rightData.length; i++) {
            data.groupCodes.push(this.EntryRLdata.rightData[i].entryCode);
        }
        this.loading = true;
        this.$axios
            .post('/entry/group/insert/detail', data)
            .then(res => {
                this.entryVisible = false;
                this.loading = false;
                this.yh_message_success('添加成功');
            })
            .catch(() => {
                this.loading = false;
            });
    }

    // 赋权
    empowermentClick() {
        let data = {
            entryRoleCodes: [], // 左边
            grantCodes: [], // 右边
        };
        for (let i = 0; i < this.Empowerment.leftData.length; i++) {
            data.grantCodes.push(this.Empowerment.leftData[i].entryCode);
        }
        for (let i = 0; i < this.Empowerment.rightData.length; i++) {
            data.entryRoleCodes.push(this.Empowerment.rightData[i].entryRoleCode);
        }
        this.loading = true;
        this.$axios
            .post('/entryRole/relation/empower', data)
            .then(res => {
                this.empowermentVisible = false;
                this.loading = false;
                this.yh_message_success('赋权成功');
            })
            .catch(() => {
                this.loading = false;
            });
    }

    async getSelectDataFromRequest() {
        let paging = {
            total: 0,
            currentPage: 1,
            totalPage: 0,
            pageSize: 2147483647,
        };
        let sorter = {
            entryCode: 'descend',
        };
        let riskEntryControlQuery = {
            entryCode: this.selectedList,
            precision: true,
        };
        await this.$axios
            .post(this.urlH + '/list', {
                paging: paging,
                sorter: sorter,
                riskEntryControlQuery: riskEntryControlQuery,
            })
            .then((res: any) => {
                this.leftTranData = res.list;
            });
    }

    beforeUpdate() {
        this.$nextTick(() => {
            (this.$refs['table'] as any).doLayout();
        });
    }

    thresholdTypeFormat(value, unit): string {
        // 三目运算符, unit为'%'和'万元'、'万股'的由后端处理了，不由numberFormat方法处理
        return ['%', '万元', '万股'].includes(unit) ? value : numberFormat(value.replace(/[^0-9.-]/gi, ''), unit) + unitShow(unit);
    }
    getstockCodeList(val: any) {
        this.$axios
            .get('/fundInfo/list/byUser/like?fundCodeOrName=' + val)
            .then((res: any) => {
                let local = [];
                for (let itme of res) {
                    let datas = itme.fundCode + '-' + itme.fundName;
                    local.push({ label: datas, id: itme.fundCode });
                }
                this.accountList = local;
            })
            .catch(() => {});
    }

    filterAssetList: any[] = [];
    filterfdAcList: any[] = [];
    time1 = null;
    filterMethodAsset(val1) {
        console.log(val1, 'val');
        const val = val1.trim();
        if (val) {
            if (this.time1) {
                clearTimeout(this.time1);
            }
            this.time1 = setTimeout(() => {
                this.filterAssetList = this.assetList.filter(
                    item =>
                        item.assetCode.toUpperCase().indexOf(val.toUpperCase()) > -1 || item.assetName.toUpperCase().indexOf(val.toUpperCase()) > -1
                );
                console.log(this.filterAssetList, 'filterAssetList');
            }, 200);
        } else {
            if (this.time1) {
                clearTimeout(this.time1);
            }
            this.filterAssetList = this.assetList;
        }
    }

    filterMethodFdAc(val1) {
        console.log(val1, 'val');
        const val = val1.trim();
        if (val) {
            if (this.time1) {
                clearTimeout(this.time1);
            }
            this.time1 = setTimeout(() => {
                this.filterfdAcList = this.fdAcList.filter(
                    item =>
                        item.fundAccountCode.toUpperCase().indexOf(val.toUpperCase()) > -1 ||
                        item.fundAccountName.toUpperCase().indexOf(val.toUpperCase()) > -1
                );
                console.log(this.filterfdAcList, 'filterfdAcList');
            }, 200);
        } else {
            if (this.time1) {
                clearTimeout(this.time1);
            }
            this.filterfdAcList = this.fdAcList;
        }
    }
    handleVisibleChange(state: boolean) {
        if (state && !this.filterfdAcList.length) {
            this.filterfdAcList = this.fdAcList;
        }

        if (state && !this.filterAssetList.length) {
            this.filterAssetList = this.assetList;
        }
    }
}
</script>
<style lang="scss" scoped>
.control-setting {
    color: #222;
    padding: 10px;
    width: 100%;
    .conterol-left {
        width: 200px;
        // height: calc(100vh - 90px);

        .left-1 {
            width: 200px;
            height: 84px;
            border: 1px solid #eee;
            padding: 10px;

            .left-p {
                margin-top: 10px;
            }
        }

        .left-2 {
            border: 1px solid #eee;
            padding: 10px;
            width: 200px;
            margin-top: 10px;
            // height: calc(100vh - 400px);

            .filter-tree {
                height: calc(100vh - 530px);
                // min-height: 100px;
                overflow: scroll;
            }
        }

        .left-3 {
            border: 1px solid #eee;
            padding: 10px;
            width: 200px;
            margin-top: 10px;
            // height: calc(100vh - 490px);
            height: 320px;

            .filter-tree {
                max-height: 300px;
                overflow: scroll;
            }
        }
    }

    .conterol-right {
        position: absolute;
        left: 220px;
        top: 10px;
        width: calc(100% - 240px);
        overflow-x: scroll;

        .right-1 {
            padding: 10px;
            display: flex;
            justify-content: end;
            flex-wrap: wrap;
            .el-button {
                margin: 2px 4px;
            }
        }

        .right-2 {
            margin-top: 10px;
            height: calc(100vh - 148px);
            min-height: 381px;
            border: 1px solid #eee;

            & /deep/ .el-table__body {
                overflow: hidden !important;
            }

            .el-icon-setting {
                color: green;
                margin-right: 5px;
            }

            .el-icon-delete {
                color: red;
                margin-right: 5px;
            }

            .el-icon-folder-add {
                color: green;
                margin-right: 5px;
            }

            .con-select-div {
                .divs {
                    width: 660px;
                    margin-top: 10px;
                    position: relative;

                    .divs-left {
                        display: inline;
                        width: 490px;

                        span {
                            margin-right: 8px;
                        }

                        .divs-left-input {
                            width: 194px;
                        }

                        .divs-left-input1 {
                            width: 315px;
                            margin-right: 2px;
                        }

                        .divs-left-input01 {
                            width: 335px;
                        }

                        .left-input2 {
                            width: 130px;
                        }
                    }

                    .divs-left1 {
                        display: inline;
                        width: 490px;
                        margin-left: -12px;

                        span {
                            margin-right: 5px;
                        }

                        .divs-left-input1 {
                            width: 335px;
                            margin-right: 4px;
                        }
                    }

                    .divs-right {
                        position: absolute;
                        right: 15px;
                        display: inline;
                        width: 210px;
                        margin-left: 15px;
                        span {
                            margin-right: 8px;
                        }

                        .ringt-input {
                            width: 140px;
                        }
                    }
                }
            }

            .aletr-tbale {
                widows: 80%;
                padding: 10px;
                overflow: scroll;
            }
        }
    }
}
/deep/ .el-select__tags {
    flex-wrap: nowrap;
    overflow: hidden;
    position: absolute;
    left: 2%;
}
/deep/ .el-dialog .el-dialog__body {
    max-height: 100vh;
}
/deep/ .editDialog .el-dialog .el-dialog__body {
    height: 460px;
}
</style>
